import { createDecorator } from "../core/instantiation";

export const IStateService = createDecorator<IStateService>('stateService');

export interface IStateService {

	getItem<T>(key: string, defaultValue: T): T;
	getItem<T>(key: string, defaultValue?: T): T | undefined;
	setItem(key: string, data?: object | string | number | boolean | undefined | null): void;
	removeItem(key: string): void;
}

export class StateService implements IStateService {

	async init(): Promise<void> {
    console.log("called StateService init funciton");
	}

	getItem<T>(key: string, defaultValue: T): T;
	getItem<T>(key: string, defaultValue: T | undefined): T | undefined;
  getItem<T>(key: string, defaultValue?: T): T | undefined {
    console.log("called StateService getItem funciton", key, defaultValue)
    return undefined;
	}

	setItem(key: string, data?: object | string | number | boolean | undefined | null): void {
		console.log("called StateService setItem funciton", key, data)
	}

	removeItem(key: string): void {
		console.log("called StateService removeItem funciton", key)
	}
}
